package com.zeildlin.seecode;

import com.zeildlin.seecode.util.MailClient;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;

@SpringBootTest
@ContextConfiguration(classes = SeecodeApplication.class)
public class Mailtexts {

    @Autowired
    private MailClient mailClient;

    @Autowired
    private TemplateEngine templateEngine;

    @Test
    public void textTextMail(){
        mailClient.sendMail("1053375407@qq.com","Test","Welcome.");
    }

    @Test
    public void textHtmlMail(){
        Context context = new Context();
        context.setVariable("username","jame");
        String Context = templateEngine.process("/mail/SendMailDemo",context);
        mailClient.sendMail("1053375407@qq.com","Test",Context);
        System.out.println(context);
    }

}
